﻿

namespace ManagerClinic.CanLamSang
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using DevExpress.XtraEditors;
    using ManagerClinic.Core.Common;
    using ManagerClinic.Core.Business;
    using ManagerClinic.Modules;
    using ManagerClinic.Ultilities.Ultility;

    public partial class frmDanhSachPhieuChanDoanHinhAnh : DevExpress.XtraEditors.XtraForm
    {
        PhieuChanDoanHinhAnhBusiness ObjPhieuBusiness = new PhieuChanDoanHinhAnhBusiness();
        PhieuChanDoanHinhAnhEntity ObjPhieuCDHA = null;
        IList<PhieuChanDoanHinhAnhEntity> lstPhieuCDHA = null;

        public frmDanhSachPhieuChanDoanHinhAnh()
        {

            InitializeComponent();
        }
        string fcnMaChanDoan()
        {
            if (gvDanhSachBenhNhanKhamBenh.RowCount > 0)
            {
                ObjPhieuCDHA = (PhieuChanDoanHinhAnhEntity)gvDanhSachBenhNhanKhamBenh.GetFocusedRow();
                return ObjPhieuCDHA.MaChanDoanHinhAnh;
            }
            else
                return null;            
        }
        private void grdDanhSachBenhNhanKhamBenh_DoubleClick(object sender, EventArgs e)
        {
            if (gvDanhSachBenhNhanKhamBenh.RowCount > 0)
            {
                frmPhieuChanDoanHinhAnh frm = new frmPhieuChanDoanHinhAnh((int)ConstantManagerClinic.StateInsertOrUpdate.Update, fcnMaChanDoan());
                frm.ShowDialog();
            }
        }
        void LoadData(int trangthai)
        {
            lstPhieuCDHA = ObjPhieuBusiness.GetPhieuChanDoanHinhAnhByNgayList(trangthai);
            if (lstPhieuCDHA != null)
            grdDanhSachBenhNhanKhamBenh.DataSource = lstPhieuCDHA;
        }

        private void radTrangThaiKhamBenh_SelectedIndexChanged(object sender, EventArgs e)
        {
            LoadData(radTrangThaiKhamBenh.SelectedIndex);
        }

        private void btnDong_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void frmDanhSachPhieuChanDoanHinhAnh_Load(object sender, EventArgs e)
        {
            LoadData(radTrangThaiKhamBenh.SelectedIndex); 
        }
    }
}